package leetcode;

import org.junit.Test;


/**
 * @author cino
 * justCode
 */
public class leetcode283 {

    @Test
    public void test(){
        int[] nums = new int[]{0,1,0,3,12};
        moveZeroes(nums);
        for (int num : nums) {
            System.out.print(num+" ");
        }
    }

    public static void moveZeroes(int[] nums) {
        if(nums==null){
            return;
        }
        int j=0;
        for(int i=0;i<nums.length;++i){
            if(nums[i]!=0){
                nums[j++] = nums[i];
            }
        }
        for(int i=j;i<nums.length;++i){
            nums[i] = 0;
        }
    }
}
